<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>课程表</title>
    <meta name="context-path" th:content="@{/}"/>
    <link rel="stylesheet" th:href="@{/resources/matrix/css/bootstrap.min.css}"/>
    <link rel="stylesheet" th:href="@{/resources/matrix/css/bootstrap-responsive.min.css}"/>
    <link rel="stylesheet" th:href="@{/resources/matrix/css/matrix-style.css}"/>
    <link rel="stylesheet" th:href="@{/resources/matrix/css/matrix-media.css}"/>
    <link rel="stylesheet" th:href="@{/resources/matrix/css/matrix-full.css}"/>
    <link rel="stylesheet" th:href="@{/resources/jquery-easyui/themes/metro/easyui.css}" />
    <link rel="stylesheet" th:href="@{/resources/matrix/font-awesome/css/font-awesome.css}"/>
    <link rel="stylesheet" th:href="@{/resources/layui/css/layui.css}" media="all">
    <link rel="stylesheet" th:href="@{/resources/css/website.css}"/>
</head>
<body class="childbody">
<div class="container-fluid">
    <!--Chart-box-->
    <div class="row-fluid">
        <div class="widget-box">
            <div class="widget-title bg_lg"><span class="icon"><i class="icon-search"></i></span>
                <h5>查询</h5>
            </div>
            <div class="widget-content nopadding">
                <form id="queryform" action="#" method="get" class="form-horizontal query-form">
                    <input type="hidden" name="userId" th:value="*{userId}" >
                    <div class="row-fluid query-row">
                        <div class="span3">
                            <div class="control-group">
                                <label class="control-label">时间段：</label>
                                <div class="controls form-group">
                                    <select class="span11 form-control" name="timeType" id="timeType">
                                        <option value="">---请选择---</option>
                                        <option th:each="rl : ${timeTypeEnums}" th:value="${rl.value}"
                                                th:text="${rl.name}"></option>
                                    </select>
                                </div>
                            </div>
                        </div>
                        <div class="span3">
                            <div class="control-group">
                                <label class="control-label">星期：</label>
                                <div class="controls form-group">
                                    <select class="span11 form-control" name="day" id="day">
                                        <option value="">---请选择---</option>
                                        <option th:each="rl : ${timeTableDayEnums}" th:value="${rl.value}"
                                                th:text="${rl.name}"></option>
                                    </select>
                                </div>
                            </div>
                        </div>
                        <div class="span3">
                            <div class="control-group">
                                <label class="control-label">课程：</label>
                                <div class="controls form-group">
                                    <select class="span11 form-control" name="courseId" id="courseId">
                                        <option value="">---请选择---</option>
                                        <option th:each="rl : ${codeList}" th:value="${rl.id}"
                                                th:text="${rl.name}"></option>
                                    </select>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="row-fluid query-row">
                        <div class="span3">
                            <div class="control-group">
                                <label class="control-label">所属班级：</label>
                                <div class="controls form-group">
                                    <select class="span6 form-control" id="county" name="clazzId">
                                    </select>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="form-actions">
                        <button id="btnSearch" type="button" class="btn btn-primary">查询</button>
                        <button id="btnResetSearch" type="button" class="btn btn-info">重置</button>
                    </div>
                </form>
            </div>
        </div>
        <!--End-Chart-box-->
        <div class="row-fluid">
            <div class="span12">
                <div class="widget-box">
                    <div class="widget-title"><span class="icon"> <i class="icon-th"></i> </span>
                        <h5>数据</h5>
                    </div>
                    <div class="widget-content nopadding">
                        <div class="table_actions">
                            <button id="btnAdd"  type="button"  class="btn btn-primary">添加</button>
                            <button id="btnEdit"  type="button"  class="btn btn-info">修改</button>
                            <button id="btnDelete"  type="button"  class="btn btn-danger">删除</button>
                        </div>
                        <table id="tablelist" class="layui-table">
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script th:src="@{/resources/js/jquery.min.js}"></script>
<script th:src="@{/resources/js/jquery-migrate-1.2.1.js}"></script>
<script th:src="@{/resources/jquery-easyui/jquery.easyui.min.js}"></script>
<script th:src="@{/resources/layui/layui.all.js}" charset="utf-8"></script>
<script th:src="@{/resources/valid/js/bootstrapValidator.js}"></script>
<script th:src="@{/resources/valid/js/language/zh_CN.js}"></script>
<script th:src="@{/resources/js/website.js}"></script>
<script th:src="@{/resources/js/system.js}"></script>
<script th:src="@{/resources/js/validation_fields.js}"></script>
<script th:inline="javascript">
    /*<![CDATA[*/
    $(document).keyup(function (event) {
        if (event.keyCode == 13) {
            search();
        }
    });
    /*]]>*/
</script>

<script th:inline="javascript">
    /*<![CDATA[*/
    var query, add, edit, del,addUsers,reset,exports;
    layui.use(['jquery', 'layer', 'laydate'], function () {
        var $ = layui.jquery,
            layer = layui.layer,
            table = layui.table;

        lay('.date').each(function () {
            laydate.render({
                elem: this
            });
        });

        var cols = [
            [
                {type: 'checkbox'},
                {field: 'sorts', width: '15%', title: '顺序', sort: true},
                {title:'课程',width:'15%',templet: function(d){
                        if(d.course){
                            return d.course.name;
                        }else{
                            return"未知";
                        }
                    }
                },
                {field: 'timeType', width: '15%', title: '类型', sort: true},
                {field: 'day', width: '15%', title: '星期', sort: true},
                {field: 'schoolName', width: '15%', title: '学校', sort: true},
                {title:'班级',width:'15%',templet: function(d){
                        if(d.clazz){
                            return d.clazz.name;
                        }else{
                            return"未知";
                        }
                    }
                }

            ]
        ];

        query = new ListQuery(table, {
            cols: cols,
            element: "#tablelist",
            url: contextRoot + "timeTableBack/list",
            page: 1,
            tableid: "user_list_table",
            extraData: function () {
                return $("#queryform").serializeObject();
            }
        })
        query.reload();

        add = new ListAdd(layer, {
            title: "添加课程",
            url: contextRoot + "timeTableBack/getAddTable",
            width: "1200px",
            height: "700px"
        }, query);

        edit = new ListEdit(layer, {
            title: "修改课程",
            url: contextRoot + "timeTableBack/getEditTable",
            width: "1200px",
            height: "700px"
        }, query);

        del = new ListDelete(layer, query, {
            url: contextRoot + "timeTableBack/doDeleteTable"
        });

        $("#btnResetSearch").bind("click", function (event) {
            $("#timeType").val("");
            $("#day").val("");
            $("#courseId").val("");
            $("#county").combotree('setValues',"");

        });

        $("#btnAdd").bind("click", function (event) {
            add.openDialog();
        });

        $("#btnSearch").bind("click", function (event) {
            query.reload();
        });

        $("#btnEdit").bind("click", function (event) {
            edit.openDialog();
        });

        $("#btnDelete").bind("click", function (event) {
            del.submit();
        });
        $('#county').combotree({
            url: contextRoot + "jwOrg/doClazzListTreeOrgByUser",
            required: true
        });
    });

    /*]]>*/
</script>
</body>
</html>